package com.qfedu.biz.impl;

import com.qfedu.biz.OrderBiz;
import com.qfedu.entity.OrderEntity;
import com.qfedu.mapper.OrderPojoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class OrderBizimpl implements OrderBiz {
@Autowired
private OrderPojoMapper orderPojoMapper;
    @Override
    public OrderEntity insertOrder(float allprice, int cid, int addressid) {
        OrderEntity orderEntity = new OrderEntity();
        orderEntity.setAddressid(addressid);
        orderEntity.setCid(cid);
        orderEntity.setOcountPrice(allprice);
        String oid = UUID.randomUUID().toString().replaceAll("-", "");
        orderEntity.setOid(oid);
        Boolean aBoolean = orderPojoMapper.insertOrder(orderEntity);
        return orderEntity;
    }

    @Override
    public Boolean updataStatus(String oid,int ostatus) {
        Boolean aBoolean = orderPojoMapper.updateStatus(oid,ostatus);

        return aBoolean;
    }
//查询订单
    @Override
    public List<OrderEntity> queryOrderById(OrderEntity orderEntity) {
        List<OrderEntity> orderEntities = orderPojoMapper.queryOrderById(orderEntity);
        return orderEntities;
    }
}
